package com.kma.summer2012.model;
// Generated Dec 6, 2012 12:14:41 AM by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CrumbsCatalogOfTools generated by hbm2java
 */
@Entity
@Table(name = "CRUMBS_CATALOG_OF_TOOLS"
        , schema = "KMA1"
)
public class CrumbsCatalogOfTools implements java.io.Serializable {


    private int id;
    private String name;
    private String toolsDescription;
    private Set<CrumbsCatalogOfWork> crumbsCatalogOfWorks = new HashSet<CrumbsCatalogOfWork>(0);
    private Set<CrumbsAdditionalTools> crumbsAdditionalToolses = new HashSet<CrumbsAdditionalTools>(0);

    public CrumbsCatalogOfTools() {
    }


    public CrumbsCatalogOfTools(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public CrumbsCatalogOfTools(int id, String name, String toolsDescription, Set<CrumbsCatalogOfWork> crumbsCatalogOfWorks, Set<CrumbsAdditionalTools> crumbsAdditionalToolses) {
        this.id = id;
        this.name = name;
        this.toolsDescription = toolsDescription;
        this.crumbsCatalogOfWorks = crumbsCatalogOfWorks;
        this.crumbsAdditionalToolses = crumbsAdditionalToolses;
    }

    @Id

    @Column(name = "ID", unique = true, nullable = false, precision = 9, scale = 0)
    public int getId() {
        return this.id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Column(name = "NAME", nullable = false, length = 40)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "TOOLS_DESCRIPTION", length = 1000)
    public String getToolsDescription() {
        return this.toolsDescription;
    }

    public void setToolsDescription(String toolsDescription) {
        this.toolsDescription = toolsDescription;
    }

    @ManyToMany(cascade = {CascadeType.REFRESH, CascadeType.MERGE, CascadeType.PERSIST}, fetch = FetchType.LAZY)
    @JoinTable(name = "CRUMBS_WORK_AND_TOOLS", schema = "KMA1", joinColumns = {
            @JoinColumn(name = "TOOL_ID", nullable = false, updatable = false)}, inverseJoinColumns = {
            @JoinColumn(name = "WORK_ID", nullable = false, updatable = false)})
    public Set<CrumbsCatalogOfWork> getCrumbsCatalogOfWorks() {
        return this.crumbsCatalogOfWorks;
    }

    public void setCrumbsCatalogOfWorks(Set<CrumbsCatalogOfWork> crumbsCatalogOfWorks) {
        this.crumbsCatalogOfWorks = crumbsCatalogOfWorks;
    }

    @OneToMany(cascade = {CascadeType.REFRESH, CascadeType.MERGE, CascadeType.PERSIST}, fetch = FetchType.LAZY, mappedBy = "crumbsCatalogOfTools")
    public Set<CrumbsAdditionalTools> getCrumbsAdditionalToolses() {
        return this.crumbsAdditionalToolses;
    }

    public void setCrumbsAdditionalToolses(Set<CrumbsAdditionalTools> crumbsAdditionalToolses) {
        this.crumbsAdditionalToolses = crumbsAdditionalToolses;
    }


}


